home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.std.c
- Subject: Re: atexit() and return from main()
- Date: 22 Jan 1996 15:43:09 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Jan22084309@qcd.lanl.gov>
- References: <4dhfja$j50@fg70.rz.uni-karlsruhe.de> <4diicg$i9e@lyra.csx.cam.ac.uk>
- <TANMOY.96Jan18084025@qcd.lanl.gov>
- <DLKrx7.6p6@ukpsshp1.serigate.philips.nl>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: baynes@ukpsshp1.serigate.philips.nl's message of Mon, 22 Jan 1996 09:05:31 GMT
-
- --text follows this line--
- In article <DLKrx7.6p6@ukpsshp1.serigate.philips.nl>
- baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes) writes:
- <snip>
- <snip>
- : main() calls setjmp() and then calls exit(). An atexit() function
- : calls longjmp() and returns to main(). This repeats (or does it?)
-
- : Neither of these is permitted in any sense that I understand!
- : 7.10.4.3: If more than one call to the exit function is executed by
- : a program, the behaviour is undefined. No `permission by omission'
- : that I can see.
-
- In this example what happens if no second call to exit is been made (after
- longjumping back to main the program does not attempt to call exit again -
- instead it keeps executing indefinately)?
-
- I don't understand the question: are you asking what happens if a
- program keeps executing indefinitely? Well, it just keeps executing
- indefinitely. After that infinite period, the rest of the exit
- processing happens and a return status is indicated to the rts.
-
- Does a return from main count as a call to exit for the purposes of the
- one call restriction in 7.10.4.3? I assume it does because it is regarded
- as equivalent.
-
- I think so.
-
- What happens if an atexit function calls atexit ? If you interpret the
- standard strictly I think the program has to enter a timewarp back to the
- call to exit and start with the just registered atexit function!
-
- I do not agree. An atexit registers a function to be called at normal
- program termination: and the only reference to normal program
- termination I find is the call to exit. So, if there is no further
- call to exit there is not _further_ normal program termination: and if
- there is a call to exit, the behaviour is undefined :-)
-
- My sense of aesthetics rebels at the notion of `further normal program
- termination': probably a better wording is possible.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-